﻿Imports System.Net.Mail

Public Class ContactUs
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_Send.Click
        Dim feedBack As New MailMessage()
        feedBack.[To].Add("kasunrajapakse@hotmail.com")
        feedBack.From = New MailAddress("kasunrajapakse@hotmail.com")
        feedBack.Subject = tb_Subject.Text

        feedBack.Body = (("Sender Name: " + User.Identity.Name & "<br><br>Sender Email: ") + tb_Email.Text & "<br><br>") + tb_Message.Text
        feedBack.IsBodyHtml = True
        Dim smtp As New SmtpClient()
        smtp.Host = "smtp.live.com"
        'Or Your SMTP Server Address
        smtp.Port = 587
        smtp.EnableSsl = True
        smtp.Credentials = New System.Net.NetworkCredential("kasunrajapakse@hotmail.com", "windowslive")
        'Or your Smtp Email ID and Password
        smtp.Send(feedBack)

    End Sub
End Class